<!DOCTYPE html>
<html>
<head>
   <title>CSS Animations - computed value during animation delay</title>
   <link rel="author" title="Opera Software ASA" href="http://www.opera.com/">
   <link rel="help" href="http://dev.w3.org/csswg/css3-animations/#animations">
   <meta name="flags" content="dom">
   <meta name="assert" content="An animation does not affect the computed value
   before the animation delay has expired">
   <script src="/resources/testharness.js"></script>
   <script src="/resources/testharnessreport.js"></script>
   <style type="text/css">
      @keyframes grow {
         from {
            width: 200px;
         }
         to {
            width: 200px;
         }
      }
      div {
         width: 100px;
         height: 100px;
         background: blue;
      }
      .test {
         animation: grow 1s;
         animation-delay: 0.5s;
      }
   </style>
   <script type="text/javascript">
      setup({explicit_done:true});
      onload = function() {
         var testName = document.querySelector('title').firstChild.data;
         var div = document.querySelector('div');
         var log = document.querySelectorAll('p')[1].firstChild;
         var timeout = setTimeout(function() {
            test(function(){assert_true(false);}, testName); done();
            log.data = 'FAIL';
         }, 1000);
         div.addEventListener('animationstart', function() {
            clearTimeout(timeout);
            test(function(){assert_true(passed);}, testName); done();
            log.data = passed ? 'PASS if the animation occurred.' : 'FAIL';
         });
         div.className = 'test';
         var divWidth = getComputedStyle(div, null).width;
         var passed = divWidth == '100px';
      }
   </script>
   <style>iframe{display:none}</style>
</head>
<body>
   <p>Below there should appear a blue square for half a second, turning into a
   wide rectangle for 1 second and then back to a square.</p>
   <p>Testing...</p>
   <div></div>
</body>
</html>
